<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HTTP Client</title>
</head>
<body>
    <h1>HTTP Client</h1>
    <input type="text" id="messageInput" placeholder="Enter message">
    <button onclick="sendPostJsonDataRequestDemo()">Send</button>
    <div id="response"></div>

    <script src="jquery-1.10.2.min.js"></script>
    <script>
        function sendPostJsonDataRequestDemo() {
            const messageInput = document.getElementById('messageInput');
            const responseDiv = document.getElementById('response');
            // 创建 JSON 数据
            const data = {
                Keyword: messageInput.value,
                searchType: "all",
                searchLang: "zh"
            };
            sender({
                data: data,
                base_url: 'http://localhost:8000',
                ContentType: 'application/json',
                use_extend_url: {
                    enable: true,
                    url: '/api/public/v1/flink/data/submit'
                }
            },  (responseText)=>{
                responseDiv.innerHTML = 'Response: ' + responseText;
            }, (statusText)=>{
                responseDiv.innerHTML = 'Error: ' + statusText;
            }, (errorText)=>{
                responseDiv.innerHTML = 'Error: ' + errorText;
            })
        }
    </script>
</body>
</html>
